<%@ Page Language="C#" MasterPageFile="~/manager/logger.master" AutoEventWireup="true"
    CodeFile="security.aspx.cs" Inherits="SmartParking.Web.Manager.Security"
    Title="SmartParking >> Manager :: Security Schema" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="ADEVSO" Namespace="ADEVSO.Web.UI.WebControls" TagPrefix="ADEVSO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LoggerContentPlaceHolder" runat="Server">
    <asp:UpdatePanel ID="upSecurity" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <table width="100%" border="0" cellspacing="8" cellpadding="2">
                <tr>
                    <td>
                        <h1>Manage Roles</h1>
                    </td>
                    <td>
                        <h1>Manage Permissions</h1>
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        <ADEVSO:GridView ID="grdRoles" runat="server" AutoGenerateColumns="False" EnableViewState="true"
                            EmptyDataText="No roles found." GridLines="Horizontal" OnRowCommand="grdRoles_RowCommand" Width="200px">
                            <Columns>
                                <asp:TemplateField HeaderText="IdPark" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="lbIdPark" runat="server" Text='<%# Bind("RoleID") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Role">
                                    <ItemTemplate>
                                        <asp:Label ID="lbName" runat="server" Text='<%# Bind("Name") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnEdit" runat="server" Text="Edit" CausesValidation="false"
                                            CommandName="EditRole" CommandArgument='<%# Bind("RoleID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="DeleteRole"
                                            CausesValidation="false" CommandArgument='<%# Bind("RoleID") %>'></asp:LinkButton>
                                        <cc1:ConfirmButtonExtender ID="ceDelete" runat="server" ConfirmText="Are you sure that want to delete this role?"
                                            TargetControlID="lbtnDelete">
                                        </cc1:ConfirmButtonExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </ADEVSO:GridView>
                    </td>
                    <td valign="top">
                        <ADEVSO:GridView ID="grdPermission" runat="server" CaptionAlign="Top" AutoGenerateColumns="False"
                            GridLines="Horizontal" EmptyDataText="No permissions found."
                            ForeColor="#333333" PageSize="5" CellPadding="3" OnRowCommand="grdPermission_RowCommand" Width="230px">
                            <PagerSettings Mode="NumericFirstLast" Position="Bottom" />
                            <Columns>
                                <asp:TemplateField HeaderText="IdPermission" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="lbIdPark" runat="server" Text='<%# Bind("PermissionID") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Permission">
                                    <ItemTemplate>
                                        <asp:Label ID="lbName" runat="server" Text='<%# Bind("Name") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnEdit" runat="server" Text="Edit" CommandName="EditPermission"
                                            CausesValidation="false" CommandArgument='<%# Bind("PermissionID") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CausesValidation="false"
                                            CommandName="DeletePermission" CommandArgument='<%# Bind("PermissionID") %>'></asp:LinkButton>
                                        <cc1:ConfirmButtonExtender ID="ceDelete" runat="server" ConfirmText="Are you sure that want to delete this permission?"
                                            TargetControlID="lbtnDelete">
                                        </cc1:ConfirmButtonExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </ADEVSO:GridView>
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <asp:HiddenField ID="hfRoleId" runat="server" />
                        Role: &nbsp;&nbsp;<asp:TextBox ID="txtRoleName" runat="server" ValidationGroup="Role"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvRoleName" runat="server" ErrorMessage="*" ForeColor="Red"
                            Font-Bold="true" ControlToValidate="txtRoleName" ValidationGroup="Role"></asp:RequiredFieldValidator>
                        <asp:LinkButton ID="lnkAddRole" runat="server" OnClick="lnkAddRole_Click" ValidationGroup="Role">Save</asp:LinkButton>
                    </td>
                    <td align="left">
                        <asp:HiddenField ID="hfPermissionId" runat="server" />
                        Permission: &nbsp;&nbsp;<asp:TextBox ID="txtPermissionName" runat="server" ValidationGroup="Permission"></asp:TextBox><asp:RequiredFieldValidator
                            ID="rfvPermissionName" runat="server" ErrorMessage="*" ForeColor="Red" Font-Bold="true"
                            ValidationGroup="Permission" ControlToValidate="txtPermissionName"></asp:RequiredFieldValidator>
                        &nbsp;&nbsp;
                        <asp:LinkButton ID="lbtnAddPermission" runat="server" OnClick="lbtnAddPermission_Click"
                            ValidationGroup="Permission">Save</asp:LinkButton>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
